<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/white/common/common.jsp"%>
<%@include file="/white/common/taglibs.jsp"%>
<html>
<head>
<script type="text/javascript">
        <!--
        function submitForm(){
            var searchForm=document.getElementById("searchForm");
            searchForm.submit();
        }

        function notAllowedLockSelf(id){
            var searchForm=document.getElementById("searchForm");
            searchForm.action="userAction-"+id+"!lock.action";
            searchForm.submit();
        }

        function validateModify(){
        	var check = document.getElementsByName("selectedIds");
        	var a = 0;
            var id;

            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a++;
                    id = check[i].value;
                }
            }

            if(a == 1){
            	var searchForm=document.getElementById("searchForm");
            	searchForm.action="alarmInfoAction-"+id+"!toEdit.action";
                return true;
            }else{
                alert("请先择你要修改的数据");
                return false;
            }
        }

        function validateDelete(){
            var check=document.getElementsByName("selectedIds");
            var a=false;
            for(var i=0;i <check.length;i++){
                if(check[i].checked==true){
                    a=true;
                    break;
                }
            }
            if(a){
                return confirm('你确定要删除?');
            }else{
                alert("请先择你要删除的内容!");
                return false;
            }
        }

        function doDelete(){
            var searchForm=document.getElementById("searchForm");
            searchForm.action='alarmInfoAction!delete.action';
            searchForm.submit();
            return true;
        }

        function displayResult(){
            var result = "<s:property value='result'/>";
            if(result != null && result != ""){
                alert(result);
            }
        }

    //-->
    </script>
</head>
<body onload="displayResult()">
<s:form method="post" action="alarmInfoAction!queryByPage.action"
	theme="simple" id="searchForm">
	<div id="div_title">
	<h3>告警信息管理</h3>
	<div id="div_search">
	<table>
		<tr>
			<!-- 查询条件 -->
			<td width="80" align="right" nowrap="nowrap">告警类别:</td>
			<td><s:select list="alarmTypeList" listKey="dictValue"
				listValue="dictName" headerKey="" headerValue="全部" name="query_alarmType"
				id="query_alarmType"/></td>
			<td width="80" align="right" nowrap="nowrap">告警级别:</td>
			<td><s:select list="alarmLevelList" listKey="dictValue"
				listValue="dictName" headerKey="" headerValue="全部" name="query_alarmLevel"
				id="query_alarmLevel"/></td>
			<td width="80" align="right" nowrap="nowrap">告警状态:</td>
			<td><s:select list="alarmStatusList" listKey="dictValue"
				listValue="dictName" headerKey="" headerValue="全部" name="query_status"
				id="query_status"/></td>
			<td width="80" align="right" nowrap="nowrap">告警原因:</td>
			<td><s:textfield name="query_cause" /></td>
			<td width="80" align="right"><authz:authorize
				ifAnyGranted="SMOOTH_ALL">
				<s:submit cssClass="submit_search" value="搜索"
					action="alarmInfoAction!queryByPage" />
			</authz:authorize></td>
		</tr>
	</table>
	</div>
	</div>
	<div id="div_button"><authz:authorize ifAnyGranted="SMOOTH_ALL">
		<s:submit value="修改" onclick="return validateModify()"
			cssClass="input_button" />
	</authz:authorize> <authz:authorize ifAnyGranted="SMOOTH_ALL">
		<input type="button" value="删除"
			onclick="if(validateDelete()){doDelete()}" class="input_button">
	</authz:authorize> <%@include file="/white/common/message.jsp"%>
	</div>
	<!--列表 -->
	<table cellpadding="0" cellspacing="0" class="t_list">
		<tr>
			<th><input type="checkbox" onclick="selectCheckbox();"
				name="checkbox2" value="checkbox" /></th>
			<!--列表头部 -->
			<th nowrap="nowrap">告警类别</th>
			<th nowrap="nowrap">告警级别</th>
			<th nowrap="nowrap">告警状态</th>
			<th nowrap="nowrap">通知次数</th>
			<th nowrap="nowrap">告警时间</th>
			<th nowrap="nowrap">确认时间</th>
			<th nowrap="nowrap">清除时间</th>
			<th nowrap="nowrap">告警原因</th>
			<th nowrap="nowrap">清除过程</th>
		</tr>
		<s:iterator value="resultList" status="sindex">
			<tr>
				<td><c:if test="${ USER_ID!=null }"><input type="checkbox" name="selectedIds" value="${ ID }" id="selectedIds" /></c:if></td>
				<td><c:forEach items="${alarmTypeList}" var="alarmType"><c:if test="${ALARM_TYPE==alarmType.dictValue}">${alarmType.dictName}</c:if></c:forEach></td>
				<td nowrap="nowrap"><c:forEach items="${alarmLevelList}" var="alarmLevel"><c:if test="${ALARM_LEVEL==alarmLevel.dictValue}">${alarmLevel.dictName}</c:if></c:forEach></td>
				<td nowrap="nowrap"><c:forEach items="${alarmStatusList}" var="alarmStatus"><c:if test="${STATUS==alarmStatus.dictValue}">${alarmStatus.dictName}</c:if></c:forEach></td>
				<td><s:property value="NOTIFY_TIMES" />/<s:property value="THRESHOLD_TIMES" /></td>
				<td><s:property value="CREATE_TIME" /></td>
				<td><s:property value="CONFIRM_TIME" /></td>
				<td><s:property value="REVOCER_TIME" /></td>
				<td><s:property value="CAUSE" /></td>
				<td><s:property value="REVOCER_DESC" /></td>
			</tr>
		</s:iterator>
	</table>
	<!--列表结束-->
	<!--分页-->
	<s:if test="resultList.size() > 0">
		<table border="0" cellspacing="0" cellpadding="0" class="t_bottom">
			<tr>
				<td><%@include file="/white/common/pageList.jsp"%></td>
			</tr>
		</table>
	</s:if>
	<!--分页结束-->

</s:form>
</body>
</html>
